Skip to content

fix(node): strip framing separator from bodyless errors - #64

Open
zakazaka95 wants to merge 1 commit into
quicknode:mainfrom
zakazaka95:fix/node-error-message-framing
Open

zakazaka95 wants to merge 1 commit into
quicknode:mainfrom
zakazaka95:fix/node-error-message-framing

Conversation

@zakazaka95

Copy link
Copy Markdown

Bodyless Node SDK errors include a trailing \u001f in their public message. The native binding appends this framing separator even when the tag has no response body, but the JavaScript parser previously removed it only for body-bearing errors.

Remove exactly that final framing character for bodyless errors. Preserve embedded and literal trailing separators, legacy messages without the separator, error subclasses, and the existing UTF-8 byte-length handling for response bodies.

Add regression assertions to the normal Node test runner for all six bodyless kinds, Unicode and empty messages, body-bearing controls, JSON-RPC metadata, and synchronous/asynchronous client wrapping. The focused function can also run without the native extension; the default npm test still runs the existing native assertions after it.

Validation:

  • The exact regression fails on the original parser and passes with the fix, using the real fromNapiError and wrapClient modules.
  • Node 24.22.1 syntax checks and the focused error-message assertions pass. Independently rerun during review.
  • Locked npm ci passes; dependencies and lockfile are unchanged.
  • npm run build was attempted and fails because Cargo is unavailable in this Windows environment. Normal npm test passes the new assertions, then fails to load the unavailable Windows native binding. The native suite is not claimed to pass; the existing Linux CI build/test path remains unchanged.

No API requests, credentials, account operations, wallet generation, signing or payments were used. Prepared with AI assistance; the independent review was also performed by an AI agent.

Preserve the original error message when the native error tag has no response body. Cover every bodyless error kind, literal separators, UTF-8 bodies and synchronous/asynchronous client wrapping in the normal Node test runner.

Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant